#ifndef _BACKUP_IMAGE_BIM_H_
#define _BACKUP_IMAGE_BIM_H_
enum
{
    PRT_RESET                    =        0xCC00,
    PRT_PSECTION_SECTION_VER_SAME =        0xCC10,
    PRT_PSECTION_SECTION_VER_DIFF =        0xCC11,
    PRT_PSECTION_A_STATUS_NORMAL =        0xCC20,
    PRT_PSECTION_A_STATUS_ABNORMAL =      0xCC21,
    PRT_PSECTION_A_STATUS_EARSED =        0xCC22,
    PRT_PSECTION_B_STATUS_NORMAL =        0xCC30,
    PRT_PSECTION_B_STATUS_ABNORMAL =        0xCC31,
    PRT_PSECTION_B_STATUS_EARSED =        0xCC32,
    PRT_ERASE_PSEC_A =        0xCCE0,
    PRT_ERASE_PSEC_B =        0xCCE1,
    PRT_TRANSFER_CONTROL_POWER   =       0xDDDD,
    PRT_TRANSFER_CONTROL_POWER_A   =       0xDDDA,
    PRT_TRANSFER_CONTROL_POWER_B   =       0xDDDB,
    PRT_TRANSFER_CONTROL_POWER_ERROR   =       0xDDDE,
    PRT_END
};
/* Memory layout ATTENTION: u want to modify it, PLS check the scatter file, thx!!!
 * Section Description                              Section Size        Offset
 * Boot                                                 3840                0
 * Empty                                                                        32
 * Primary 4.0 BOOT Section                         3872                3872
 * Primary 4.0 A Section(include boot)      244k               3872 + 3872
 * Empty                                                                        3136
 * Primary 4.0 B Section(include boot)      237k                3872 + 3872 + 3136 + 244k
 */
#define BIM_SECTION_SIZE                 (3840)
#define BOOT_40_SECTION_SIZE              (3872)
#define PRIMARY_40_SECTION_A_SIZE         (1024 * 244)
#define PRIMARY_40_SECTION_B_SIZE         (1024 * 237)
/*  memory layout: three sections
 *  1, boot section;
 *  2, primary section A, started/ended with primary_boundary struct(psec);
 *  3, primary section B, started/ended with primary_boundary struct(bsec);
 *  detail information, please refer to associative code and macro.
 */
/*Every Section has two identification structures*/
#define BOUNDARY_SIZE                            (sizeof(SECTION_BOUNDARY_T))
#define PSEC_40_IMAGE_A_ADDR                     (0xF20)   //CRC = 0XF20 * 34 / 32 = 4114
#define PSEC_40_IMAGE_B_ADDR                     (0X3D2E0) //CRC = 0X3D2D2 * 34 / 32 = 260k
#define PSEC_40_A_LEFT_BOUNDARY_ADDR             (PSEC_40_IMAGE_A_ADDR + BOOT_40_SECTION_SIZE )
#define PSEC_40_B_LEFT_BOUNDARY_ADDR             (PSEC_40_IMAGE_B_ADDR + BOOT_40_SECTION_SIZE )
#define BIM_CRC_SECTION_SIZE          ((BIM_SECTION_SIZE >> 5) * (ENCRYPT_FRAME_SIZE + ENCRYPT_CRC_SIZE))  //CRC_PACKET_LEN=2; ENCRYPT_FRAME_LEN=32
#define BOOT_40_CRC_SECTION_SIZE          ((BOOT_40_SECTION_SIZE >> 5) * (ENCRYPT_FRAME_SIZE + ENCRYPT_CRC_SIZE))  //CRC_PACKET_LEN=2; ENCRYPT_FRAME_LEN=32
#define PRIMARY_40_CRC_SECTION_A_SIZE   ((PRIMARY_40_SECTION_A_SIZE >> 5) * (ENCRYPT_FRAME_SIZE + ENCRYPT_CRC_SIZE))
#define PRIMARY_40_CRC_SECTION_B_SIZE   ((PRIMARY_40_SECTION_B_SIZE >> 5) * (ENCRYPT_FRAME_SIZE + ENCRYPT_CRC_SIZE))
#define PSEC_40_CRC_IMAGE_A_ADDR          (((PSEC_40_IMAGE_A_ADDR) >> 5) * (ENCRYPT_FRAME_SIZE + ENCRYPT_CRC_SIZE))
#define PSEC_40_CRC_IMAGE_B_ADDR          (((PSEC_40_IMAGE_B_ADDR) >> 5) * (ENCRYPT_FRAME_SIZE + ENCRYPT_CRC_SIZE))
#define PSEC_40_CRC_A_LEFT_BOUNDARY_ADDR    (((PSEC_40_A_LEFT_BOUNDARY_ADDR) >> 5) * (ENCRYPT_FRAME_SIZE + ENCRYPT_CRC_SIZE))
#define PSEC_40_CRC_B_LEFT_BOUNDARY_ADDR    ((PSEC_40_B_LEFT_BOUNDARY_ADDR >> 5) * (ENCRYPT_FRAME_SIZE + ENCRYPT_CRC_SIZE))
#endif // _BACKUP_IMAGE_H_
// eof
